package com.xiaohai.common;

/**
 * ClassName:GetContext
 * Package:IntelliJ IDEA
 * Description: 获取上下文(基于ThreadLocal线程实现)
 * Author 何诗海
 *
 * @Create 2024/1/16 9:31
 * @Version 1.0
 */
public class GetContext {
    private static final ThreadLocal<Long> thread = new ThreadLocal<>();

    public static void setThread(Long id) {
        thread.set(id);
    }

    public static Long getThread() {
        return thread.get();
    }

    public static void remove() {
        thread.remove();
    }
}
